from examples import sample1

def each(arr, callback):
	ret = []
	for item in arr:
		ret.append(callback(item))
	return ret

def flagList(digits, length):
	arr = []
	for i in range(0, length):
		arr.append(i in digits)
	return arr

def compare(strings, unit_len = 1, rejected_flags = []):
	str_len = len(strings[0])

	# flags = flagList(rejected_digits)
	flags = rejected_flags
	if len(flags) == 0:
		flags = [False for i in range(str_len)]
	if not len(flags) == str_len:
		raise Exception("Flags length not match")
	ret_flags = [False for i in range(str_len)]

	i = 0
	i_max = str_len - unit_len + 1
	i_upper = 0
	ii = 0
	not_match = False
	digit_not_match = False
	string = ""
	sub_str = ""
	last_substr = ""
	while i < i_max:
		not_match = False
		i_upper = i+unit_len
		for ii in range(i, i_upper):
			if flags[ii]:
				not_match = True
				i = ii + 1
				break
		if not_match:
			continue
		
		last_substr = strings[0][i:i_upper]
		for string in strings[1:]:
			sub_str = string[i:i_upper]
			if not last_substr == sub_str:
				not_match = True
				break
		if not_match:
			i = 
			for ii in range(i, i_upper):
				ret_flags[ii] = True
